﻿namespace TextFiles
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Text;

    class DeleteLinesInFile
    {
        // 1.2.12.09. Write a program that deletes from given text file all odd lines.
        // The result should be in the same file.

        static void Main()
        {
            StreamReader input = new StreamReader(@"../../inputAndOutput.txt", Encoding.GetEncoding("windows-1251"));
            List<string> result = new List<string>();
            using (input)
            {
                result.Add(input.ReadLine());
                while (input.ReadLine() != null)
                {
                    result.Add(input.ReadLine());
                }
                result.Remove(null);
            }

            StreamWriter output = new StreamWriter(@"../../inputAndOutput.txt");
            using (output)
            {
                for (int i = 0; i < result.Count; i++)
                {
                    output.WriteLine(result[i]);
                }
            }
        }
    }
}